/*
day275
2020.5.29
*/
#include<iostream>
#include<cmath>
using namespace std;

struct TreeNode {
    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};

class Solution {
public:
	struct Node{
		bool isbalance;
		int depth;
	}; 
	
    bool isBalanced(TreeNode* root) {
		return help(root).isbalance;
    }
    
    Node help(TreeNode *root)
    {
    	Node node;
    	if(!root)
    	{
    		node.depth=0;
    		node.isbalance=true;
    		return node; 
		}
		
		Node l=help(root->left);
		if(!l.isbalance)
		{
			node.depth=0;
    		node.isbalance=false;
    		return node;
		}
		
		Node r=help(root->right);
		if(abs(r.depth-l.depth)>1)
		{
			node.depth=0;
    		node.isbalance=false;
    		return node;
		}
		
		
		node.depth=1+max(l.depth,r.depth);
		node.isbalance=l.isbalance && r.isbalance; 
		return node;
	}
};


int main()
{
	cout<<abs(1-2);
	return 0;
}
